package org.hdl.anima.message;

import java.io.IOException;

import org.hdl.anima.common.io.InputArchive;
import org.hdl.anima.common.io.OutputArchive;

/**
 * 
 * @author qiuhd
 * @since  2014年8月21日
 */
public class CreateBackendSessionReq extends RequestAdapter {

	private int identity ;
	private String remoteAddress;
	private int remotePort;
	private String localAddress;
	private int localPort;
	private String clientType;
	
	public CreateBackendSessionReq() {
		setId(2);
	}
	
	public CreateBackendSessionReq(int identity,String remoteAddress,int remotePort,String localAddress,int localPort,String clientType) {
		this();
		this.identity = identity;
		this.remoteAddress = remoteAddress;
		this.remotePort = remotePort;
		this.localAddress = localAddress;
		this.localPort = localPort;
		this.clientType = clientType;
		
	}

	@Override
	public void doDeserialize(InputArchive in) throws IOException {
		this.identity = in.readInt();
		this.remoteAddress = in.readString();
		this.remotePort = in.readInt();
		this.localAddress = in.readString();
		this.localPort = in.readInt();
	}

	@Override
	public void doSerialize(OutputArchive out) throws IOException {
		out.writeInt(identity);
		out.writeString(remoteAddress);
		out.writeInt(remotePort);
		out.writeString(localAddress);
		out.writeInt(localPort);
	}

	public int getIdentity() {
		return identity;
	}

	public void setIdentity(int identity) {
		this.identity = identity;
	}

	public String getRemoteAddress() {
		return remoteAddress;
	}

	public void setRemoteAddress(String remoteAddress) {
		this.remoteAddress = remoteAddress;
	}

	public int getRemotePort() {
		return remotePort;
	}

	public void setRemotePort(int remotePort) {
		this.remotePort = remotePort;
	}

	public String getLocalAddress() {
		return localAddress;
	}

	public void setLocalAddress(String localAddress) {
		this.localAddress = localAddress;
	}

	public int getLocalPort() {
		return localPort;
	}

	public void setLocalPort(int localPort) {
		this.localPort = localPort;
	}
}

